"""
@file: settings.py
@author：wang
@time: 2022/2/22 0022 20:29
"""
import os
import logging


class Config:
    DEBUG = True
    base_dir = os.path.abspath(os.path.dirname(__name__))
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:root@localhost:3306/newsdb'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SECRET_KEY = "kdiklfikd87384hidhih"
    # 静态文件配置
    STATIC_DIR = os.path.join(base_dir, "static")
    # 模板配置
    TEMPLATES_DIRS = os.path.join(base_dir, "templates")
    # 头像配置
    UPLOAD_ICON_DIR = os.path.join(base_dir, "upload/icon")
    # 图片配置
    UPLOAD_PHOTO_DIR = os.path.join(base_dir, "upload/photo")

    # 日志级别-----用于调整logging等级
    """
    CRITICAL 50
    ERROR 40
    WARNING 30
    INFO 20
    DEBUG 10
    NOTSET 0
    """
    LEVEL = logging.INFO


class DevelopmentConfig(Config):
    ENV = "development"


class ProductionConfig(Config):
    ENV = "production"
    DEBUG = True
